package com.example.administrator.fangbook.dataLibrary.book;

import android.text.TextUtils;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;

@DatabaseTable(tableName = "t_shelf_books")
public class ShelfItemBook implements IShelfItem, Serializable {
    @DatabaseField
    private long mGroupId = -1;
    @DatabaseField
    protected IBookbase.BookType mType = IBookbase.BookType.Type_ChineseAll;
    //主键
    @DatabaseField(id = true)
    private String mBookId = "";
    @DatabaseField
    private String mBookName;
    @DatabaseField
    private int mReadPercent = 0;
    @DatabaseField
    private String mAuthorId;
    @DatabaseField
    private String mAuthorName;
    @DatabaseField
    private String mCoverUrl;
    @DatabaseField
    private long mLastReadTime = System.currentTimeMillis();
    @DatabaseField
    private String mLastUpdateChapterId;
    @DatabaseField
    private boolean mBaoyueFlag;
    @DatabaseField
    private int autoBuyNextFlag;
    @DatabaseField
    private int mNewChapterCnt;
    @DatabaseField
    private String ntime;
    @DatabaseField
    private int sort;

    @Override
    public String getName() {
        return mBookName;
    }

    @Override
    public String getDesc() {
        return null;
    }

    @Override
    public String getCover() {
        return null;
    }

    @Override
    public int getCoverResourceId() {
        return 0;
    }

    @Override
    public long getDate() {
        return 0;
    }

    @Override
    public String getPinYinHeadChar() {
        return null;
    }

    @Override
    public int getSort() {
        return 0;
    }

    @Override
    public int getReadPercent() {
        return 0;
    }

    public void setBookId(String bookId) {
        this.mBookId = bookId;
    }

    public String getBookId() {
        return TextUtils.isEmpty(mBookId) ? "" : mBookId;
    }

    public void setName(String name) {
        this.mBookName = name;
    }

    public void setAuthorName(String author) {
        this.mAuthorName = author;
    }

    public void setBookType(IBookbase.BookType bookType) {
        this.mType = bookType;
    }

    public IBookbase.BookType getBookType() {
        return mType;
    }

    public String getAuthorName() {
        return mAuthorName == null || mAuthorName.length() < 1 ? "未知" : mAuthorName;
    }
}
